package com.peg.rules;

import com.peg.dataobjects.Context;

/**
 * @author sad
 */
public class CharRange extends Rule {

    private char _min;
    private char _max;

    public CharRange(char min, char max) {
        _min = min;
        _max = max;
    }

    @Override
    public boolean execute(Context context) {
        char c = context.getNextChar();
        if (_min <= c && c <= _max) {
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Charrange from [" + _min + "] to [" + _max + "]";
    }
}
